package yuan.deng.controller;

import yuan.deng.domain.City;
import yuan.deng.service.CityService;
import yuan.deng.service.impl.CityServiceImp;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/city")
public class CityServlet extends HttpServlet {
    private CityService cityService=new CityServiceImp();
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        List<City> list=cityService.findAll();
        req.setAttribute("list",list);
        req.getRequestDispatcher("/pages/add.jsp").forward(req,resp);
    }
}
